package jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class LoginDemo {
    public static void main(String[] args) {
        try(Connection conn=DBUtil.getConnection())
        {
            UserInfo userInfo=InputUtil.getInputObject(new UserInfo(),"登录吧你萨比","登录");
            Statement statement=conn.createStatement();
            ResultSet rs=statement.executeQuery("SELECT * FROM userinfo where username='"+userInfo.getUsername()+"'AND "+"password='"+userInfo.getPassword()+"'");
               if(rs.next())
               {
                   System.out.println("登录成功");
               }
               else
               {
                   System.out.println("登录失败");
               }
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}
